Alex Cardelle
Keana Flores
Aeshna Prasad
The City of Detroit has long been known for its especially auto-dominated environment in both industry and in its built form. As the city tries to re-cast itself in a more equitable and environmentally-sustainable way, a focus on stronger neighborhood-level educational institutions and expansion of alternative transportation systems are necessary.
Intrigued by this need, and coupling with Detroit’s relatively flat geography, we took a closer look at the City’s current cycling capabilities by mapping the relative accessibility of reaching a city school or city library using a bicycle.
## Linking to ImageMagick 6.9.12.3
## Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp
## Disabled features: fontconfig, x11
Detroit_file <- oe_match("Detroit")
Detroit_streets <- oe_read("networks/bbbike_detroit.pbf",
download_directory = "networks",
layer = "lines",
quiet = TRUE) %>%
filter(!is.na(highway))
michigan_state_plane <- "+proj=lcc +lat_1=43.66666666666666 +lat_2=42.1 +lat_0=41.5 +lon_0=-84.36666666666666 +x_0=3999999.999984 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048 +no_defs"
Detroit_city_limits <- places("Michigan") %>%
filter(NAME == "Detroit") %>%
st_transform(crs = st_crs(Detroit_streets))
Detroit_streets <- Detroit_streets[Detroit_city_limits,]
rJava::.jgc(R.gc = TRUE)
grid <- st_sf(st_make_grid(Detroit_city_limits,
square = FALSE,
n = c(100,100),
what = "polygons"))%>%
st_filter(Detroit_city_limits)
colnames(grid) <- "geometry"
st_geometry(grid) <- "geometry"
grid <- grid %>%
mutate(id = seq(1, length(grid$geometry), by=1))
Detroit_school <- oe_read("networks/bbbike_detroit.pbf",
provider = "openstreetmap_fr",
download_directory = "networks",
layer = "points",
quiet = TRUE) %>%
filter(str_detect(other_tags,'"amenity"=>"school"')) %>%
st_filter(Detroit_city_limits) %>%
rename(id = osm_id)
ggplot(Detroit_streets) +
geom_sf(color = 'azure2', alpha = 0.2) +
geom_sf(data = Detroit_school, color = "pink4") +
coord_sf(crs = michigan_state_plane) +
theme_void()
First, we examined the cycling capabilities to Detroit’s schools. Plotted above is the location of the schools under our analysis located within the city limits. At first look, they seem equitably distributed throughout the city’s gridded street infrastructure and neighborhoods.
grid_points <- st_centroid(grid)
ggplot() +
geom_sf(data = grid_points, size = 0.75) +
geom_sf(data = Detroit_school, color = "pink4") +
theme_map()
r5r_core <- setup_r5("networks", verbose = FALSE)
ttm_school <- travel_time_matrix(r5r_core = r5r_core,
origins = st_transform(x = Detroit_school, crs = "WGS84"),
destinations = st_transform(x = grid_points, crs = "WGS84"),
mode = "BICYCLE",
departure_datetime = as.POSIXct("15-11-2021 14:00:00",
format = "%d-%m-%Y %H:%M:%S"),
max_walk_dist = 1000,
max_trip_duration = 480,
verbose = FALSE)
tt_wide_school <- ttm_school %>%
pivot_wider(names_from = fromId,
names_prefix = "from", values_from = travel_time) %>%
rename(id = toId) %>%
merge(grid) %>%
replace(is.na(.), 999) %>%
rowwise() %>%
mutate(from_any = min(c_across(starts_with("from")), na.rm = TRUE))
st_geometry(tt_wide_school) <- "geometry"
ggplot() +
geom_sf(data = tt_wide_school,
aes(fill = from_any),
color = NA) +
geom_sf(data = Detroit_school, color = 'ivory3') +
geom_sf(data = Detroit_streets , alpha = 0.05)+
scale_fill_gradientn(colors = wes_palette(name = "Chevalier1", n= 3, type = "continuous"),
name = "Cycling time to\nthe nearest school\n(minutes)",
position = "right") +
coord_sf(crs = michigan_state_plane) +
theme_map()+
theme(legend.position = "right")
We can see that there is wide school coverage, with the majority of schools being reachable within a 20-minute bike ride. Some neighborhoods, particularly in the southwest quadrant face a longer commute, however a cursory analysis revealed they are relatively industrial areas.
iso_pallete <- wes_palette("Royal2", n = 5)
iso5min_school <- tt_wide_school[tt_wide_school$from_any < 6,] %>%
st_union()
iso10min_school <- tt_wide_school[tt_wide_school$from_any < 11,] %>%
st_union()
iso15min_school <- tt_wide_school[tt_wide_school$from_any < 16,] %>%
st_union()
ggplot(Detroit_streets) +
geom_sf(data = iso15min_school,
aes(fill = "Area within 15 minutes"),
color = NA) +
geom_sf(data = iso10min_school,
aes(fill = "Area within 10 minutes"),
color = NA) +
geom_sf(data = iso5min_school,
aes(fill = "Area within 5 minutes"),
color = NA) +
geom_sf(alpha = 0.1) +
scale_fill_manual(values = c(iso_pallete[1],
iso_pallete[3],
iso_pallete[5]),
name = "Cycling \ntime to the\nnearest school\n(minutes)") +
coord_sf(crs = michigan_state_plane) +
theme_map()
In inverting the analysis, we plotted a series of isochrones radiating from the individual schools. Again, we see relatively equitable distribution of schools throughout the city that can be reached in under 20 minutes.
Detroit_access_school <- accessibility(r5r_core,
origins = school_points,
destinations = school_points,
mode = "BICYCLE",
opportunities_colname = "num_school",
decay_function = "step",
cutoffs = 11,
max_walk_dist = 5000,
time_window = 120,
percentile = 50,
verbose = FALSE) %>%
mutate(id = as.numeric(from_id)) %>%
merge(grid)
st_geometry(Detroit_access_school) <- "geometry"
ggplot(Detroit_access_school) +
geom_sf(aes(fill = accessibility), color = NA) +
scale_fill_viridis_c(name = "Schools within \n a 20-minute \nbicycle ride") +
coord_sf(crs = michigan_state_plane) +
theme_void()
However, when we apply an accessibility step function to count how many schools are reachable on a 20-minute bike ride, the disparity begins to more clearly appear. Although residents living near the Downtown/CBD of the City can reach up to 10 total schools on a 20 minute bike ride, this accessibility fades to less than 2 schools per 20 minute ride for neighborhoods more than a few miles from the Downtown area.
Detroit_school_access2 <- accessibility(r5r_core,
origins = school_points,
destinations = school_points,
mode = "BICYCLE",
opportunities_colname = "num_school",
decay_function = "exponential",
cutoffs = 11,
departure_datetime = as.POSIXct("15-11-2021 14:00:00",
format = "%d-%m-%Y %H:%M:%S"),
max_walk_dist = 5000,
time_window = 120,
percentiles = 50,
verbose = FALSE) %>%
mutate(id = as.numeric(from_id)) %>%
merge(grid)
st_geometry(Detroit_school_access2) <- "geometry"
ggplot(Detroit_school_access2) +
geom_sf(aes(fill = accessibility), color = NA) +
scale_fill_viridis_c(name = "Accessiblity score") +
coord_sf(crs = michigan_state_plane) +
theme_void()
rJava::.jgc(R.gc = TRUE)
st_write(Detroit_school_access2, 'Detroit_school_access.geojson', append=FALSE, quiet=TRUE )
access_poly_school <- st_read("Detroit_school_access.geojson", quiet=TRUE)
access_raster_school <- st_rasterize(access_poly_school["accessibility"],
nx = 1000, ny = 1000)
plot(access_raster_school)
ggplot(Detroit_streets) +
geom_stars(data = access_raster_school) +
geom_sf(color = "white", alpha = 0.05) +
scale_fill_viridis_c(na.value = NA,
option="A",
name = "Accessibility score \nof bicycle access to\nschools") +
theme_void()
To give our analysis more clarity, we combined the Detroit street network with an overlay raster layer containing the previous accessibility information. For a finer understanding, we then converted the accessibility metric into a “score” giving a relative index of how many schools are reachable within a 20 minute bike ride throughout the neighborhoods. Again, we can see a high score, reflecting easy accessibility and density of school biking opportunities, for most neighborhoods immediately in and surrounding the Downtown area.
Detroit_library <- oe_read("networks/bbbike_detroit.pbf",
provider = "openstreetmap_fr",
download_directory = "networks",
layer = "points",
quiet = TRUE) %>%
filter(str_detect(other_tags, '"amenity"=>"library')) %>%
st_filter(Detroit_city_limits) %>%
rename(id = osm_id)
ggplot(Detroit_streets) +
geom_sf(color = 'azure2', alpha = 0.2) +
geom_sf(data = Detroit_library, color = "darkorchid1") +
coord_sf(crs = michigan_state_plane) +
theme_void()
To add to our understanding of cycling to educational opportunities, we examined libraries using the same metrics as the previously displayed schools. Here, we have plotted them throughout Detroit. Curiously, we note that although the libraries appear evenly distributed around the city, the upper northwest quadrant appears underserved.
ttm_library <- travel_time_matrix(r5r_core = r5r_core,
origins = st_transform(x = Detroit_library, crs = "WGS84"),
destinations = st_transform(x = grid_points, crs = "WGS84"),
mode = "BICYCLE",
departure_datetime = as.POSIXct("15-11-2021 14:00:00",
format = "%d-%m-%Y %H:%M:%S"),
max_walk_dist = 1000,
max_trip_duration = 480,
verbose = FALSE)
tt_wide_library <- ttm_library %>%
pivot_wider(names_from = fromId,
names_prefix = "from", values_from = travel_time) %>%
rename(id = toId) %>%
merge(grid) %>%
replace(is.na(.), 999) %>%
rowwise() %>%
mutate(from_any = min(c_across(starts_with("from")), na.rm = TRUE))
st_geometry(tt_wide_library) <- "geometry"
ggplot(Detroit_streets) +
geom_sf(data = tt_wide_library,
aes(fill = from_any),
color = NA) +
geom_sf(alpha = 0.1) +
scale_fill_gradient2(low = "green", mid = "yellow", high = "red",
midpoint = 30,
name = "bike\ntime to the\nnearest library\n(minutes)") +
coord_sf(crs = michigan_state_plane) +
theme_map()
This map illustrates areas that can reach libraries within 100 minutes. We can see that most of the central areas of the city can reach a library in about 30 minutes or less. However, this quickly rises to above an hour and a half for the underserved northwest quadrant.
iso_pallete <- wes_palette("Darjeeling1", n = 5)
iso10min <- tt_wide_library[tt_wide_library$from_any < 11,] %>%
st_union()
iso20min <- tt_wide_library[tt_wide_library$from_any < 21,] %>%
st_union()
iso30min <- tt_wide_library[tt_wide_library$from_any < 31,] %>%
st_union()
ggplot(Detroit_streets) +
geom_sf(data = iso30min,
aes(fill = "Area within 30 minutes"),
color = NA) +
geom_sf(data = iso20min,
aes(fill = "Area within 20 minutes"),
color = NA) +
geom_sf(data = iso10min,
aes(fill = "Area within 10 minutes"),
color = NA) +
geom_sf(alpha = 0.1) +
scale_fill_manual(values = c(iso_pallete[1],
iso_pallete[3],
iso_pallete[5]),
name = "bike\ntime to the\nnearest library\n(minutes)") +
coord_sf(crs = michigan_state_plane) +
theme_map()
Our isochrone furthers our earlier understanding; it is possible to bike from a library to most neighborhoods in the city within a 20-minute bike ride. However, that is impossible for the entire northwest quadrant’s residential population.
Detroit_library_access <- accessibility(r5r_core,
origins = library_points,
destinations = library_points,
mode = "BICYCLE",
opportunities_colname = "num_library",
decay_function = "step",
cutoffs = 11,
departure_datetime = as.POSIXct("15-11-2021 14:00:00",
format = "%d-%m-%Y %H:%M:%S"),
max_walk_dist = 5000,
time_window = 120,
percentiles = 50,
verbose = FALSE) %>%
mutate(id = as.numeric(from_id)) %>%
merge(grid)
st_geometry(Detroit_library_access) <- "geometry"
ggplot(Detroit_library_access) +
geom_sf(aes(fill = accessibility), color = NA) +
scale_fill_viridis_c(name = "Libraries\nwithin a 20-minute\nbicycle ride") +
coord_sf(crs = michigan_state_plane) +
theme_void()
When plotting an accessibility layer, we can see spatially the number of libraries a resident in the city can reach within a 20 minute bike ride. Interestingly, when constrained to 20 minutes, most neighborhoods in the city cannot reach a single library. The only exception are three small areas in the city that can reach up to two libraries. As the map illustrates, at best some neighborhoods can reach a single library in that timeframe, while the northwest quadrant cannot access any at all.
ggplot(Detroit_streets) +
geom_stars(data = access_raster_library) +
geom_sf(color = "white", alpha = 0.05) +
scale_fill_viridis_c(na.value = NA,
option="A",
name = "Accessibility score \nof bicycle access to\nlibraries") +
theme_void()
In our final analysis map, we calculated an accessibility score for library access for Detroit’s neighborhoods. With this more granular detail, we can distill that the only place in the city with generous library access is the Downtown/CBD. The vast majority of the city has limited access to a single library at best, and in many areas (shown in black here), libraries remain scare and faraway.
Our analysis has revealed that much needs to be improved in the realm of physical access to neighborhood educational institutions in Detroit. Perhaps with the exception of the Downtown area, more cycling infrastructure, or library facilities themselves, need to be added throughout the city. Schools seem more equally distributed, although the disparate cycling times suggest some need for improvement. In terms of urgency, the northwest quadrant’s complete lack of library access is the most inequitable and glaring takeaway from our findings.
Each member of our group made important and different contributions to the final product. Aeshna sourced all the data and created all the maps regarding Detroit’s school system. Keana sourced all the data and created all the maps regarding Detroit’s library system. Alex collated our code into a GitHub repository, along with two maps on accessibility. Therefore, the group allocated each individual member an even share of points.
All of the data files used in this project were sourced from the City of Detroit and the BBBike Project.